package com.yuefan;

// 价格满减实现类
class FullDiscount {
    private final double fullAmount; //满额
    private final double discountAmount; //扣减金额

    public FullDiscount(double fullAmount, double discountAmount) {
        this.fullAmount = fullAmount;
        this.discountAmount = discountAmount;
    }

    public double apply(double totalPrice) {
        if (totalPrice >= fullAmount) {
            return totalPrice - discountAmount;
        } else {
            return totalPrice;
        }
    }
}